home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / x11 / viewers / xvpng.diff < prev   
Text File  |  1997-08-26  |  50KB  |  1,643 lines

  1.  
  2. This is v1.2 of the PNG patch for xv.  This version adds a PNG dialog
  3. so that the gamma, compression, interlacing, and filters can be selected
  4. when saving PNG images.  The gamma dial needed floating point values, so
  5. it required modifying the Dial widget, and subsequently affected all of
  6. the popups that use a Dial (jpeg, ps, and color).
  7.  
  8. To add PNG support to xv, you need the xv-3.10a source code, libpng and zlib.
  9.  
  10. To apply the patch, go into the xv-3.10a directory and execute
  11. patch -p1 < thisfile
  12.  
  13. The Makefile expects libpng and zlib to be already compiled.  The versions
  14. I used were libpng-0.89 and zlib 1.0.2, but it should work with later
  15. versions.  You will also have to modify the makefile to give the location
  16. of libpng and zlib on your system.
  17.  
  18. Andreas Dilger <adilger@enel.ucalgary.ca>
  19. http://www-mddsp.enel.ucalgary.ca/People/adilger/
  20.  
  21. Alexander Lehmann <lehmann@mathematik.th-darmstadt.de>
  22. http://www.mathematik.th-darmstadt.de/~lehmann/
  23.  
  24. diff -c3 xv-3.10a/Makefile xv-3.10b/Makefile
  25. *** xv-3.10a/Makefile    Mon Jan 23 13:20:54 1995
  26. --- xv-3.10b/Makefile    Tue Jun  4 00:26:17 1996
  27. ***************
  28. *** 53,58 ****
  29. --- 53,77 ----
  30.       cd $(JPEGDIR) ; ./configure CC='$(CC)'
  31.   $(JPEGLIB):  $(JPEGDIR)/jconfig.h
  32.       cd $(JPEGDIR) ; make
  33. + ###
  34. + ### if, for whatever reason, you're unable to get the PNG library to compile
  35. + ### on your machine, *COMMENT OUT* the following lines
  36. + ###
  37. + PNG    = -DDOPNG
  38. + PNGDIR = /usr/local/src/libpng
  39. + PNGINC = -I$(PNGDIR)
  40. + PNGLIB = -L$(PNGDIR) -lpng
  41. + ###
  42. + ### if, for whatever reason, you're unable to get the PNG library to compile
  43. + ### on your machine, *COMMENT OUT* the following lines
  44. + ###
  45. + ZLIBDIR = /usr/local/src/zlib
  46. + ZLIBINC = -I$(ZLIBDIR)
  47. + ZLIBLIB = -L$(ZLIBDIR) -lz
  48.   
  49.   
  50.   ###
  51. ***************
  52. *** 186,194 ****
  53.   
  54.   CFLAGS = $(CCOPTS) $(JPEG) $(JPEGINC) $(TIFF) $(TIFFINC) $(PDS) \
  55.       $(NODIRENT) $(VPRINTF) $(TIMERS) $(UNIX) $(BSDTYPES) $(RAND) \
  56. !     $(DXWM) $(MCHN)
  57.   
  58. ! LIBS = -lX11 $(JPEGLIB) $(TIFFLIB) -lm
  59.   
  60.   OBJS =     xv.o xvevent.o xvroot.o xvmisc.o xvimage.o xvcolor.o xvsmooth.o \
  61.       xv24to8.o xvgif.o xvpm.o xvinfo.o xvctrl.o xvscrl.o xvalg.o \
  62. --- 189,197 ----
  63.   
  64.   CFLAGS = $(CCOPTS) $(JPEG) $(JPEGINC) $(TIFF) $(TIFFINC) $(PDS) \
  65.       $(NODIRENT) $(VPRINTF) $(TIMERS) $(UNIX) $(BSDTYPES) $(RAND) \
  66. !     $(DXWM) $(MCHN) $(PNG) $(PNGINC) $(ZLIBINC)
  67.   
  68. ! LIBS = -lX11 $(JPEGLIB) $(TIFFLIB) $(PNGLIB) $(ZLIBLIB) -lm
  69.   
  70.   OBJS =     xv.o xvevent.o xvroot.o xvmisc.o xvimage.o xvcolor.o xvsmooth.o \
  71.       xv24to8.o xvgif.o xvpm.o xvinfo.o xvctrl.o xvscrl.o xvalg.o \
  72. ***************
  73. *** 196,202 ****
  74.       xvdial.o xvgraf.o xvsunras.o xvjpeg.o xvps.o xvpopup.o xvdflt.o \
  75.       xvtiff.o xvtiffwr.o xvpds.o xvrle.o xviris.o xvgrab.o vprintf.o \
  76.       xvbrowse.o xvtext.o xvpcx.o xviff.o xvtarga.o xvxpm.o xvcut.o \
  77. !     xvxwd.o xvfits.o
  78.   
  79.   MISC = README INSTALL CHANGELOG IDEAS
  80.   
  81. --- 199,205 ----
  82.       xvdial.o xvgraf.o xvsunras.o xvjpeg.o xvps.o xvpopup.o xvdflt.o \
  83.       xvtiff.o xvtiffwr.o xvpds.o xvrle.o xviris.o xvgrab.o vprintf.o \
  84.       xvbrowse.o xvtext.o xvpcx.o xviff.o xvtarga.o xvxpm.o xvcut.o \
  85. !     xvxwd.o xvfits.o xvpng.o
  86.   
  87.   MISC = README INSTALL CHANGELOG IDEAS
  88.   
  89. ***************
  90. *** 267,273 ****
  91.   xvbrowse.o:    bits/br_pcx bits/br_jfif bits/br_tiff bits/br_pds 
  92.   xvbrowse.o:    bits/br_ps bits/br_iff bits/br_targa bits/br_xpm
  93.   xvbrowse.o:    bits/br_trash bits/fcurs bits/fccurs bits/fdcurs bits/fcursm
  94. ! xvbrowse.o:     bits/br_xwd
  95.   
  96.   xvbutt.o:    bits/cboard50 bits/rb_frame bits/rb_frame1 bits/rb_top
  97.   xvbutt.o:    bits/rb_bot bits/rb_dtop bits/rb_dbot bits/rb_body
  98. --- 262,268 ----
  99.   xvbrowse.o:    bits/br_pcx bits/br_jfif bits/br_tiff bits/br_pds 
  100.   xvbrowse.o:    bits/br_ps bits/br_iff bits/br_targa bits/br_xpm
  101.   xvbrowse.o:    bits/br_trash bits/fcurs bits/fccurs bits/fdcurs bits/fcursm
  102. ! xvbrowse.o:     bits/br_xwd bits/br_png
  103.   
  104.   xvbutt.o:    bits/cboard50 bits/rb_frame bits/rb_frame1 bits/rb_top
  105.   xvbutt.o:    bits/rb_bot bits/rb_dtop bits/rb_dbot bits/rb_body
  106. diff -c3 xv-3.10a/Makefile.std xv-3.10b/Makefile.std
  107. *** xv-3.10a/Makefile.std    Mon Jan 23 13:20:54 1995
  108. --- xv-3.10b/Makefile.std    Tue Jun  4 00:26:17 1996
  109. ***************
  110. *** 53,58 ****
  111. --- 53,77 ----
  112.       cd $(JPEGDIR) ; ./configure CC='$(CC)'
  113.   $(JPEGLIB):  $(JPEGDIR)/jconfig.h
  114.       cd $(JPEGDIR) ; make
  115. + ###
  116. + ### if, for whatever reason, you're unable to get the PNG library to compile
  117. + ### on your machine, *COMMENT OUT* the following lines
  118. + ###
  119. + PNG    = -DDOPNG
  120. + PNGDIR = /usr/local/src/libpng
  121. + PNGINC = -I$(PNGDIR)
  122. + PNGLIB = -L$(PNGDIR) -lpng
  123. + ###
  124. + ### if, for whatever reason, you're unable to get the PNG library to compile
  125. + ### on your machine, *COMMENT OUT* the following lines
  126. + ###
  127. + ZLIBDIR = /usr/local/src/zlib
  128. + ZLIBINC = -I$(ZLIBDIR)
  129. + ZLIBLIB = -L$(ZLIBDIR) -lz
  130.   
  131.   
  132.   ###
  133. ***************
  134. *** 186,194 ****
  135.   
  136.   CFLAGS = $(CCOPTS) $(JPEG) $(JPEGINC) $(TIFF) $(TIFFINC) $(PDS) \
  137.       $(NODIRENT) $(VPRINTF) $(TIMERS) $(UNIX) $(BSDTYPES) $(RAND) \
  138. !     $(DXWM) $(MCHN)
  139.   
  140. ! LIBS = -lX11 $(JPEGLIB) $(TIFFLIB) -lm
  141.   
  142.   OBJS =     xv.o xvevent.o xvroot.o xvmisc.o xvimage.o xvcolor.o xvsmooth.o \
  143.       xv24to8.o xvgif.o xvpm.o xvinfo.o xvctrl.o xvscrl.o xvalg.o \
  144. --- 189,197 ----
  145.   
  146.   CFLAGS = $(CCOPTS) $(JPEG) $(JPEGINC) $(TIFF) $(TIFFINC) $(PDS) \
  147.       $(NODIRENT) $(VPRINTF) $(TIMERS) $(UNIX) $(BSDTYPES) $(RAND) \
  148. !     $(DXWM) $(MCHN) $(PNG) $(PNGINC) $(ZLIBINC)
  149.   
  150. ! LIBS = -lX11 $(JPEGLIB) $(TIFFLIB) $(PNGLIB) $(ZLIBLIB) -lm
  151.   
  152.   OBJS =     xv.o xvevent.o xvroot.o xvmisc.o xvimage.o xvcolor.o xvsmooth.o \
  153.       xv24to8.o xvgif.o xvpm.o xvinfo.o xvctrl.o xvscrl.o xvalg.o \
  154. ***************
  155. *** 196,202 ****
  156.       xvdial.o xvgraf.o xvsunras.o xvjpeg.o xvps.o xvpopup.o xvdflt.o \
  157.       xvtiff.o xvtiffwr.o xvpds.o xvrle.o xviris.o xvgrab.o vprintf.o \
  158.       xvbrowse.o xvtext.o xvpcx.o xviff.o xvtarga.o xvxpm.o xvcut.o \
  159. !     xvxwd.o xvfits.o
  160.   
  161.   MISC = README INSTALL CHANGELOG IDEAS
  162.   
  163. --- 199,205 ----
  164.       xvdial.o xvgraf.o xvsunras.o xvjpeg.o xvps.o xvpopup.o xvdflt.o \
  165.       xvtiff.o xvtiffwr.o xvpds.o xvrle.o xviris.o xvgrab.o vprintf.o \
  166.       xvbrowse.o xvtext.o xvpcx.o xviff.o xvtarga.o xvxpm.o xvcut.o \
  167. !     xvxwd.o xvfits.o xvpng.o
  168.   
  169.   MISC = README INSTALL CHANGELOG IDEAS
  170.   
  171. ***************
  172. *** 267,273 ****
  173.   xvbrowse.o:    bits/br_pcx bits/br_jfif bits/br_tiff bits/br_pds 
  174.   xvbrowse.o:    bits/br_ps bits/br_iff bits/br_targa bits/br_xpm
  175.   xvbrowse.o:    bits/br_trash bits/fcurs bits/fccurs bits/fdcurs bits/fcursm
  176. ! xvbrowse.o:     bits/br_xwd
  177.   
  178.   xvbutt.o:    bits/cboard50 bits/rb_frame bits/rb_frame1 bits/rb_top
  179.   xvbutt.o:    bits/rb_bot bits/rb_dtop bits/rb_dbot bits/rb_body
  180. --- 262,268 ----
  181.   xvbrowse.o:    bits/br_pcx bits/br_jfif bits/br_tiff bits/br_pds 
  182.   xvbrowse.o:    bits/br_ps bits/br_iff bits/br_targa bits/br_xpm
  183.   xvbrowse.o:    bits/br_trash bits/fcurs bits/fccurs bits/fdcurs bits/fcursm
  184. ! xvbrowse.o:     bits/br_xwd bits/br_png
  185.   
  186.   xvbutt.o:    bits/cboard50 bits/rb_frame bits/rb_frame1 bits/rb_top
  187.   xvbutt.o:    bits/rb_bot bits/rb_dtop bits/rb_dbot bits/rb_body
  188. diff -c3 xv-3.10a/xv.c xv-3.10b/xv.c
  189. *** xv-3.10a/xv.c    Thu Jan 19 11:08:43 1995
  190. --- xv-3.10b/xv.c    Sat Jun  1 15:49:31 1996
  191. ***************
  192. *** 277,282 ****
  193. --- 277,286 ----
  194.     tiffW = (Window) NULL;  tiffUp = 0;
  195.   #endif
  196.   
  197. + #ifdef HAVE_PNG
  198. +   pngW = (Window) NULL;  pngUp = 0;
  199. + #endif
  200.     imap = ctrlmap = gmap = browmap = cmtmap = 0;
  201.   
  202.     ch_offx = ch_offy = p_offx = p_offy = 0;
  203. ***************
  204. *** 782,787 ****
  205. --- 787,796 ----
  206.     XSetTransientForHint(theDisp, tiffW, dirW);
  207.   #endif
  208.     
  209. + #ifdef HAVE_PNG
  210. +   CreatePNGW();
  211. +   XSetTransientForHint(theDisp, pngW, dirW);
  212. + #endif
  213.     
  214.     LoadFishCursors();
  215.     SetCursors(-1);
  216. ***************
  217. *** 2611,2616 ****
  218. --- 2620,2630 ----
  219.          (magicno[0]=='I' && magicno[1]=='I'))        rv = RFT_TIFF;
  220.   #endif
  221.   
  222. + #ifdef HAVE_PNG
  223. +   else if (magicno[0]==0x89 && magicno[1]=='P' &&
  224. +            magicno[2]=='N'  && magicno[3]=='G')                  rv = RFT_PNG;
  225. + #endif
  226.   #ifdef HAVE_PDS
  227.     else if (strncmp((char *) magicno,  "NJPL1I00", (size_t) 8)==0 ||
  228.          strncmp((char *) magicno+2,"NJPL1I",   (size_t) 6)==0 ||
  229. ***************
  230. *** 2671,2676 ****
  231. --- 2685,2694 ----
  232.     case RFT_TIFF:    rv = LoadTIFF  (fname, pinfo);           break;
  233.   #endif
  234.   
  235. + #ifdef HAVE_PNG
  236. +   case RFT_PNG:     rv = LoadPNG   (fname, pinfo);         break;
  237. + #endif
  238.   #ifdef HAVE_PDS
  239.     case RFT_PDSVICAR: rv = LoadPDS  (fname, pinfo);           break;
  240.   #endif
  241. diff -c3 xv-3.10a/xv.h xv-3.10b/xv.h
  242. *** xv-3.10a/xv.h    Mon Jan 23 13:22:23 1995
  243. --- xv-3.10b/xv.h    Wed May 29 14:50:54 1996
  244. ***************
  245. *** 8,15 ****
  246.   #include "config.h"
  247.   
  248.   
  249. ! #define REVDATE   "Version 3.10a  Rev: 12/29/94"
  250. ! #define VERSTR    "3.10a"
  251.   
  252.   /*
  253.    * uncomment the following, and modify for your site, but only if you've
  254. --- 8,15 ----
  255.   #include "config.h"
  256.   
  257.   
  258. ! #define REVDATE   "Version 3.10a  Rev: 12/29/94 (PNG patch 1.2)"
  259. ! #define VERSTR    "3.10a(PNG)"
  260.   
  261.   /*
  262.    * uncomment the following, and modify for your site, but only if you've
  263. ***************
  264. *** 327,332 ****
  265. --- 327,336 ----
  266.   #define HAVE_TIFF
  267.   #endif
  268.   
  269. + #ifdef DOPNG
  270. + #define HAVE_PNG
  271. + #endif
  272.   #ifdef DOPDS
  273.   #define HAVE_PDS
  274.   #endif
  275. ***************
  276. *** 458,481 ****
  277.   #define F_TIFINC  0
  278.   #endif
  279.   
  280.   
  281.   #define F_GIF         0
  282.   #define F_JPEG      ( 0 + F_JPGINC)
  283.   #define F_TIFF      ( 0 + F_JPGINC + F_TIFINC)
  284. ! #define F_PS        ( 1 + F_JPGINC + F_TIFINC)
  285. ! #define F_PBMRAW    ( 2 + F_JPGINC + F_TIFINC)
  286. ! #define F_PBMASCII  ( 3 + F_JPGINC + F_TIFINC)
  287. ! #define F_XBM       ( 4 + F_JPGINC + F_TIFINC)
  288. ! #define F_XPM       ( 5 + F_JPGINC + F_TIFINC)
  289. ! #define F_BMP       ( 6 + F_JPGINC + F_TIFINC)
  290. ! #define F_SUNRAS    ( 7 + F_JPGINC + F_TIFINC)
  291. ! #define F_IRIS      ( 8 + F_JPGINC + F_TIFINC)
  292. ! #define F_TARGA     ( 9 + F_JPGINC + F_TIFINC)
  293. ! #define F_FITS      (10 + F_JPGINC + F_TIFINC)
  294. ! #define F_PM        (11 + F_JPGINC + F_TIFINC)
  295. ! #define F_DELIM1    (12 + F_JPGINC + F_TIFINC)     /* ----- */
  296. ! #define F_FILELIST  (13 + F_JPGINC + F_TIFINC)
  297. ! #define F_MAXFMTS   (14 + F_JPGINC + F_TIFINC)     /* 15, normally */
  298.   
  299.   
  300.   
  301. --- 461,491 ----
  302.   #define F_TIFINC  0
  303.   #endif
  304.   
  305. + #ifdef HAVE_PNG
  306. + #define F_PNGINC  1
  307. + #else
  308. + #define F_PNGINC  0
  309. + #endif
  310.   
  311.   #define F_GIF         0
  312.   #define F_JPEG      ( 0 + F_JPGINC)
  313.   #define F_TIFF      ( 0 + F_JPGINC + F_TIFINC)
  314. ! #define F_PNG       ( 0 + F_JPGINC + F_TIFINC + F_PNGINC)
  315. ! #define F_PS        ( 1 + F_JPGINC + F_TIFINC + F_PNGINC)
  316. ! #define F_PBMRAW    ( 2 + F_JPGINC + F_TIFINC + F_PNGINC)
  317. ! #define F_PBMASCII  ( 3 + F_JPGINC + F_TIFINC + F_PNGINC)
  318. ! #define F_XBM       ( 4 + F_JPGINC + F_TIFINC + F_PNGINC)
  319. ! #define F_XPM       ( 5 + F_JPGINC + F_TIFINC + F_PNGINC)
  320. ! #define F_BMP       ( 6 + F_JPGINC + F_TIFINC + F_PNGINC)
  321. ! #define F_SUNRAS    ( 7 + F_JPGINC + F_TIFINC + F_PNGINC)
  322. ! #define F_IRIS      ( 8 + F_JPGINC + F_TIFINC + F_PNGINC)
  323. ! #define F_TARGA     ( 9 + F_JPGINC + F_TIFINC + F_PNGINC)
  324. ! #define F_FITS      (10 + F_JPGINC + F_TIFINC + F_PNGINC)
  325. ! #define F_PM        (11 + F_JPGINC + F_TIFINC + F_PNGINC)
  326. ! #define F_DELIM1    (12 + F_JPGINC + F_TIFINC + F_PNGINC)   /* ----- */
  327. ! #define F_FILELIST  (13 + F_JPGINC + F_TIFINC + F_PNGINC)
  328. ! #define F_MAXFMTS   (14 + F_JPGINC + F_TIFINC + F_PNGINC)   /* 17, normally */
  329.   
  330.   
  331.   
  332. ***************
  333. *** 505,510 ****
  334. --- 515,521 ----
  335.   #define RFT_XPM      17
  336.   #define RFT_XWD      18
  337.   #define RFT_FITS     19
  338. + #define RFT_PNG      20
  339.   
  340.   /* definitions for page up/down, arrow up/down list control */
  341.   #define LS_PAGEUP   0
  342. ***************
  343. *** 765,773 ****
  344.   typedef struct { Window win;            /* window ID */
  345.            int x,y,w,h;           /* window coords in parent */
  346.            int active;            /* true if can do anything*/
  347. !          int min,max;           /* min/max values 'pos' can take */
  348. !          int val;               /* 'value' of dial */
  349. !          int page;              /* amt val change on pageup/pagedown */
  350.            char *title;           /* title for this guage */
  351.            char *units;           /* string appended to value */
  352.            u_long fg,bg,hi,lo;    /* colors */
  353. --- 776,785 ----
  354.   typedef struct { Window win;            /* window ID */
  355.            int x,y,w,h;           /* window coords in parent */
  356.            int active;            /* true if can do anything*/
  357. !          double min,max;        /* min/max values 'pos' can take */
  358. !          double val;            /* 'value' of dial */
  359. !          double inc;            /* amt val change on up/down */
  360. !          double page;           /* amt val change on pageup/pagedown */
  361.            char *title;           /* title for this guage */
  362.            char *units;           /* string appended to value */
  363.            u_long fg,bg,hi,lo;    /* colors */
  364. ***************
  365. *** 1154,1159 ****
  366. --- 1166,1178 ----
  367.   #endif
  368.   
  369.   
  370. + #ifdef HAVE_PNG
  371. + /* stuff used for 'png' box */
  372. + WHERE Window        pngW;
  373. + WHERE int           pngUp;        /* is pngW mapped, or what? */
  374. + #endif
  375.   #undef WHERE
  376.   
  377.   
  378. ***************
  379. *** 1465,1476 ****
  380.   
  381.   
  382.   /*************************** XVDIAL.C ***************************/
  383. ! void DCreate               PARM((DIAL *, Window, int, int, int, int, int, 
  384. !                  int, int, int, u_long, u_long, u_long, 
  385. !                  u_long, char *, char *));
  386.   
  387. ! void DSetRange             PARM((DIAL *, int, int, int, int));
  388. ! void DSetVal               PARM((DIAL *, int));
  389.   void DSetActive            PARM((DIAL *, int));
  390.   void DRedraw               PARM((DIAL *));
  391.   int  DTrack                PARM((DIAL *, int, int));
  392. --- 1484,1495 ----
  393.   
  394.   
  395.   /*************************** XVDIAL.C ***************************/
  396. ! void DCreate               PARM((DIAL *, Window, int, int, int, int, double,
  397. !                                  double, double, double, double, u_long,
  398. !                                  u_long, u_long, u_long, char *, char *));
  399.   
  400. ! void DSetRange             PARM((DIAL *, double,double,double,double,double));
  401. ! void DSetVal               PARM((DIAL *, double));
  402.   void DSetActive            PARM((DIAL *, int));
  403.   void DRedraw               PARM((DIAL *));
  404.   int  DTrack                PARM((DIAL *, int, int));
  405. ***************
  406. *** 1612,1617 ****
  407. --- 1631,1643 ----
  408.   void  TIFFDialog           PARM((int));
  409.   int   TIFFCheckEvent       PARM((XEvent *));
  410.   void  TIFFSaveParams       PARM((char *, int));
  411. + /**************************** XVPNG.C ***************************/
  412. + int  LoadPNG               PARM((char *, PICINFO *));
  413. + void CreatePNGW            PARM((void));
  414. + void PNGDialog             PARM((int));
  415. + int  PNGCheckEvent         PARM((XEvent *));
  416. + void PNGSaveParams         PARM((char *, int));
  417.   
  418.   /**************************** XVPDS.C ***************************/
  419.   int LoadPDS                PARM((char *, PICINFO *));
  420. diff -c3 xv-3.10a/xvbrowse.c xv-3.10b/xvbrowse.c
  421. *** xv-3.10a/xvbrowse.c    Thu Jan 19 10:49:17 1995
  422. --- xv-3.10b/xvbrowse.c    Sun Mar 17 14:56:42 1996
  423. ***************
  424. *** 55,60 ****
  425. --- 55,61 ----
  426.   #include "bits/br_xpm"
  427.   #include "bits/br_xwd"
  428.   #include "bits/br_fits"
  429. + #include "bits/br_png"
  430.   
  431.   #include "bits/br_trash"
  432.   #include "bits/fcurs"
  433. ***************
  434. *** 94,100 ****
  435.   #define BF_XPM      25
  436.   #define BF_XWD      26
  437.   #define BF_FITS     27
  438. ! #define BF_MAX      28    /* # of built-in icons */
  439.   
  440.   #define ISLOADABLE(ftyp) (ftyp!=BF_DIR  && ftyp!=BF_CHR && ftyp!=BF_BLK && \
  441.                 ftyp!=BF_SOCK && ftyp!=BF_FIFO) 
  442. --- 95,102 ----
  443.   #define BF_XPM      25
  444.   #define BF_XWD      26
  445.   #define BF_FITS     27
  446. ! #define BF_PNG      28
  447. ! #define BF_MAX      29    /* # of built-in icons */
  448.   
  449.   #define ISLOADABLE(ftyp) (ftyp!=BF_DIR  && ftyp!=BF_CHR && ftyp!=BF_BLK && \
  450.                 ftyp!=BF_SOCK && ftyp!=BF_FIFO) 
  451. ***************
  452. *** 524,529 ****
  453. --- 526,532 ----
  454.     bfIcons[BF_XPM] =MakePix1(br->win,br_xpm_bits, br_xpm_width, br_xpm_height);
  455.     bfIcons[BF_XWD] =MakePix1(br->win,br_xwd_bits, br_xwd_width, br_xwd_height);
  456.     bfIcons[BF_FITS]=MakePix1(br->win,br_fits_bits,br_fits_width,br_fits_height);
  457. +   bfIcons[BF_PNG]=MakePix1(br->win,br_png_bits,br_png_width,br_png_height);
  458.   
  459.   
  460.     /* check that they all got built */
  461. ***************
  462. *** 3020,3025 ****
  463. --- 3023,3029 ----
  464.       case RFT_XPM:      bf->ftype = BF_XPM;      break;
  465.       case RFT_XWD:      bf->ftype = BF_XWD;      break;
  466.       case RFT_FITS:     bf->ftype = BF_FITS;     break;
  467. +     case RFT_PNG:      bf->ftype = BF_PNG;      break;
  468.       }
  469.     }
  470.   }
  471. ***************
  472. *** 3567,3572 ****
  473. --- 3571,3577 ----
  474.     case RFT_XPM:      strcat(str,"XPM file");              break;
  475.     case RFT_XWD:      strcat(str,"XWD file");              break;
  476.     case RFT_FITS:     strcat(str,"FITS file");             break;
  477. +   case RFT_PNG:      strcat(str,"PNG file");              break;
  478.     default:           strcat(str,"file of unknown type");  break;
  479.     }
  480.     
  481. diff -c3 xv-3.10a/xvdial.c xv-3.10b/xvdial.c
  482. *** xv-3.10a/xvdial.c    Tue Jan  3 14:20:31 1995
  483. --- xv-3.10b/xvdial.c    Wed May 29 14:37:54 1996
  484. ***************
  485. *** 41,60 ****
  486.   
  487.   
  488.   /* local functions */
  489. ! static int  whereInDial     PARM((DIAL *, int, int));
  490. ! static void drawArrow       PARM((DIAL *));
  491. ! static void drawValStr      PARM((DIAL *));
  492. ! static void drawButt        PARM((DIAL *, int, int));
  493. ! static int  computeDialVal  PARM((DIAL *, int, int));
  494. ! static void dimDial         PARM((DIAL *));
  495.   
  496.   
  497.   /***************************************************/
  498. ! void DCreate(dp, parent, x, y, w, h, minv, maxv, curv, page, 
  499.                 fg, bg, hi, lo, title, units)
  500.   DIAL         *dp;
  501.   Window        parent;
  502. ! int           x,y,w,h,minv,maxv,curv,page;
  503.   unsigned long fg,bg,hi,lo;
  504.   char         *title, *units;
  505.   {
  506. --- 41,61 ----
  507.   
  508.   
  509.   /* local functions */
  510. ! static int    whereInDial     PARM((DIAL *, int, int));
  511. ! static void   drawArrow       PARM((DIAL *));
  512. ! static void   drawValStr      PARM((DIAL *));
  513. ! static void   drawButt        PARM((DIAL *, int, int));
  514. ! static double computeDialVal  PARM((DIAL *, int, int));
  515. ! static void   dimDial         PARM((DIAL *));
  516.   
  517.   
  518.   /***************************************************/
  519. ! void DCreate(dp, parent, x, y, w, h, minv, maxv, curv, inc, page, 
  520.                 fg, bg, hi, lo, title, units)
  521.   DIAL         *dp;
  522.   Window        parent;
  523. ! int           x,y,w,h;
  524. ! double        minv,maxv,curv,inc,page;
  525.   unsigned long fg,bg,hi,lo;
  526.   char         *title, *units;
  527.   {
  528. ***************
  529. *** 98,115 ****
  530.                   1,fg,bg);
  531.     if (!dp->win) FatalError("can't create dial window");
  532.   
  533. !   DSetRange(dp, minv, maxv, curv, page);
  534.     XSelectInput(theDisp, dp->win, ExposureMask | ButtonPressMask);
  535.   }
  536.   
  537.   
  538.   /***************************************************/
  539. ! void DSetRange(dp, minv, maxv, curv, page)
  540. ! DIAL *dp;
  541. ! int   minv, maxv, curv, page;
  542.   {
  543.     if (maxv<minv) maxv=minv;
  544. !   dp->min = minv;    dp->max = maxv;    dp->page = page;
  545.     dp->active =  (minv < maxv);
  546.   
  547.     DSetVal(dp, curv);
  548. --- 99,116 ----
  549.                   1,fg,bg);
  550.     if (!dp->win) FatalError("can't create dial window");
  551.   
  552. !   DSetRange(dp, minv, maxv, curv, inc, page);
  553.     XSelectInput(theDisp, dp->win, ExposureMask | ButtonPressMask);
  554.   }
  555.   
  556.   
  557.   /***************************************************/
  558. ! void DSetRange(dp, minv, maxv, curv, inc, page)
  559. ! DIAL   *dp;
  560. ! double  minv, maxv, curv, inc, page;
  561.   {
  562.     if (maxv<minv) maxv=minv;
  563. !   dp->min = minv; dp->max = maxv; dp->inc = inc; dp->page = page;
  564.     dp->active =  (minv < maxv);
  565.   
  566.     DSetVal(dp, curv);
  567. ***************
  568. *** 118,125 ****
  569.   
  570.   /***************************************************/
  571.   void DSetVal(dp, curv)
  572. ! DIAL *dp;
  573. ! int   curv;
  574.   {
  575.     RANGE(curv, dp->min, dp->max);   /* make sure curv is in-range */
  576.   
  577. --- 119,126 ----
  578.   
  579.   /***************************************************/
  580.   void DSetVal(dp, curv)
  581. ! DIAL  *dp;
  582. ! double curv;
  583.   {
  584.     RANGE(curv, dp->min, dp->max);   /* make sure curv is in-range */
  585.   
  586. ***************
  587. *** 129,135 ****
  588.     XSetForeground(theDisp, theGC, dp->bg); 
  589.     drawArrow(dp);
  590.   
  591. !   dp->val = curv;
  592.   
  593.     /* draw new arrow and string */
  594.     XSetForeground(theDisp, theGC, dp->fg);
  595. --- 130,136 ----
  596.     XSetForeground(theDisp, theGC, dp->bg); 
  597.     drawArrow(dp);
  598.   
  599. !   dp->val = (double)((int)(curv / dp->inc + (curv > 0 ? 0.5 : -0.5))) * dp->inc;
  600.   
  601.     /* draw new arrow and string */
  602.     XSetForeground(theDisp, theGC, dp->fg);
  603. ***************
  604. *** 202,208 ****
  605.   int mx,my;
  606.   {
  607.     Window       rW,cW;
  608. !   int          rx,ry, x,y, ipos, pos, lit, i, origval;
  609.     unsigned int mask;
  610.   
  611.     lit = 0;
  612. --- 203,210 ----
  613.   int mx,my;
  614.   {
  615.     Window       rW,cW;
  616. !   int          rx, ry, x, y, ipos, pos, lit;
  617. !   double       origval;
  618.     unsigned int mask;
  619.   
  620.     lit = 0;
  621. ***************
  622. *** 224,232 ****
  623.     if (ipos != INDIAL) {
  624.       drawButt(dp, ipos, 1);
  625.       switch (ipos) {
  626. !     case INCW1:  if (dp->val < dp->max) DSetVal(dp, dp->val+1); break;
  627.       case INCW2:  if (dp->val < dp->max) DSetVal(dp, dp->val+dp->page); break;
  628. !     case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-1); break;
  629.       case INCCW2: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->page); break;
  630.       }
  631.       if (dp->drawobj != NULL) (dp->drawobj)();  
  632. --- 226,234 ----
  633.     if (ipos != INDIAL) {
  634.       drawButt(dp, ipos, 1);
  635.       switch (ipos) {
  636. !     case INCW1:  if (dp->val < dp->max) DSetVal(dp, dp->val+dp->inc);  break;
  637.       case INCW2:  if (dp->val < dp->max) DSetVal(dp, dp->val+dp->page); break;
  638. !     case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->inc);  break;
  639.       case INCCW2: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->page); break;
  640.       }
  641.       if (dp->drawobj != NULL) (dp->drawobj)();  
  642. ***************
  643. *** 235,242 ****
  644.     }
  645.   
  646.     else { 
  647. !     i = computeDialVal(dp, mx, my);
  648. !     DSetVal(dp, i);
  649.       if (dp->drawobj != NULL) (dp->drawobj)();  
  650.     }
  651.   
  652. --- 237,245 ----
  653.     }
  654.   
  655.     else { 
  656. !     double v;
  657. !     v = computeDialVal(dp, mx, my);
  658. !     DSetVal(dp, v);
  659.       if (dp->drawobj != NULL) (dp->drawobj)();  
  660.     }
  661.   
  662. ***************
  663. *** 246,256 ****
  664.       if (!(mask & Button1Mask)) break;    /* button released */
  665.   
  666.       if (ipos == INDIAL) {
  667. !       int j;
  668. !       i = computeDialVal(dp, x, y);
  669. !       j = dp->val;
  670. !       DSetVal(dp, i);
  671. !       if (j != dp->val) {
  672.       /* track whatever dial controls */
  673.       if (dp->drawobj != NULL) (dp->drawobj)();  
  674.         }
  675. --- 249,259 ----
  676.       if (!(mask & Button1Mask)) break;    /* button released */
  677.   
  678.       if (ipos == INDIAL) {
  679. !       double v, w;
  680. !       v = computeDialVal(dp, x, y);
  681. !       w = dp->val;
  682. !       DSetVal(dp, v);
  683. !       if (w != dp->val) {
  684.       /* track whatever dial controls */
  685.       if (dp->drawobj != NULL) (dp->drawobj)();  
  686.         }
  687. ***************
  688. *** 266,276 ****
  689.   
  690.         if (lit) {
  691.       switch (ipos) {
  692. !     case INCW1:  if (dp->val < dp->max) DSetVal(dp, dp->val+1); 
  693.                    break;
  694.       case INCW2:  if (dp->val < dp->max) DSetVal(dp, dp->val+dp->page);
  695.                        break;
  696. !     case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-1);
  697.                        break;
  698.       case INCCW2: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->page);
  699.                        break;
  700. --- 269,279 ----
  701.   
  702.         if (lit) {
  703.       switch (ipos) {
  704. !     case INCW1:  if (dp->val < dp->max) DSetVal(dp, dp->val+dp->inc); 
  705.                    break;
  706.       case INCW2:  if (dp->val < dp->max) DSetVal(dp, dp->val+dp->page);
  707.                        break;
  708. !     case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->inc);
  709.                        break;
  710.       case INCCW2: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->page);
  711.                        break;
  712. ***************
  713. *** 320,338 ****
  714.   static void drawArrow(dp)
  715.   DIAL *dp;
  716.   {
  717. !   int i, rad, cx, cy;
  718.     XPoint arrow[4];
  719.   
  720.     rad = dp->rad;  cx = dp->cx;  cy = dp->cy;
  721.   
  722.     /* map pos (range minv..maxv) into degrees (range 240..-60) */
  723. !   i = 240 + (-300 * (dp->val - dp->min)) / (dp->max - dp->min);
  724. !   arrow[0].x = cx + (int) ((double) rad * .80 * cos(i * DEG2RAD));
  725. !   arrow[0].y = cy - (int) ((double) rad * .80 * sin(i * DEG2RAD));
  726. !   arrow[1].x = cx + (int) ((double) rad * .33 * cos((i+160) * DEG2RAD));
  727. !   arrow[1].y = cy - (int) ((double) rad * .33 * sin((i+160) * DEG2RAD));
  728. !   arrow[2].x = cx + (int) ((double) rad * .33 * cos((i-160) * DEG2RAD));
  729. !   arrow[2].y = cy - (int) ((double) rad * .33 * sin((i-160) * DEG2RAD));
  730.     arrow[3].x = arrow[0].x;
  731.     arrow[3].y = arrow[0].y;
  732.     XDrawLines(theDisp, dp->win, theGC, arrow, 4, CoordModeOrigin);
  733. --- 323,342 ----
  734.   static void drawArrow(dp)
  735.   DIAL *dp;
  736.   {
  737. !   int rad, cx, cy;
  738. !   double v;
  739.     XPoint arrow[4];
  740.   
  741.     rad = dp->rad;  cx = dp->cx;  cy = dp->cy;
  742.   
  743.     /* map pos (range minv..maxv) into degrees (range 240..-60) */
  744. !   v = 240 + (-300 * (dp->val - dp->min)) / (dp->max - dp->min);
  745. !   arrow[0].x = cx + (int) ((double) rad * .80 * cos(v * DEG2RAD));
  746. !   arrow[0].y = cy - (int) ((double) rad * .80 * sin(v * DEG2RAD));
  747. !   arrow[1].x = cx + (int) ((double) rad * .33 * cos((v+160) * DEG2RAD));
  748. !   arrow[1].y = cy - (int) ((double) rad * .33 * sin((v+160) * DEG2RAD));
  749. !   arrow[2].x = cx + (int) ((double) rad * .33 * cos((v-160) * DEG2RAD));
  750. !   arrow[2].y = cy - (int) ((double) rad * .33 * sin((v-160) * DEG2RAD));
  751.     arrow[3].x = arrow[0].x;
  752.     arrow[3].y = arrow[0].y;
  753.     XDrawLines(theDisp, dp->win, theGC, arrow, 4, CoordModeOrigin);
  754. ***************
  755. *** 343,365 ****
  756.   static void drawValStr(dp)
  757.   DIAL *dp;
  758.   {
  759. !   int  i, x1, x2;
  760.     char foo[60], foo1[60];
  761.   
  762.     /* compute longest string necessary so we can right-align this thing */
  763. !   sprintf(foo,"%d",dp->min);    x1 = strlen(foo);
  764. !   sprintf(foo,"%d",dp->max);    x2 = strlen(foo);
  765.     if (dp->min < 0 && dp->max > 0) x2++;   /* put '+' at beginning */
  766.     i = x1;  if (x2>x1) i = x2;
  767.     if (dp->units) i += strlen(dp->units);
  768.   
  769. !   if (dp->min < 0 && dp->max > 0) sprintf(foo,"%+d", dp->val);
  770. !   else sprintf(foo,"%d", dp->val);
  771.   
  772.     if (dp->units) strcat(foo,dp->units);
  773.     foo1[0] = '\0';
  774.     if (strlen(foo) < (size_t) i) {
  775. !     for (i = i - strlen(foo); i>0; i--) strcat(foo1," ");
  776.     }
  777.     strcat(foo1, foo);
  778.   
  779. --- 347,383 ----
  780.   static void drawValStr(dp)
  781.   DIAL *dp;
  782.   {
  783. !   int  tot, i, x1, x2;
  784.     char foo[60], foo1[60];
  785.   
  786.     /* compute longest string necessary so we can right-align this thing */
  787. !   sprintf(foo,"%d",(int)dp->min);    x1 = strlen(foo);
  788. !   sprintf(foo,"%d",(int)dp->max);    x2 = strlen(foo);
  789.     if (dp->min < 0 && dp->max > 0) x2++;   /* put '+' at beginning */
  790.     i = x1;  if (x2>x1) i = x2;
  791.     if (dp->units) i += strlen(dp->units);
  792.   
  793. !   sprintf(foo,"%g",dp->inc);   /* space for decimal values */
  794. !   tot = i + strlen(foo) - 1;   /* Take away the 0 from the beginning */
  795. !   if (dp->min < 0.0 && dp->max > 0.0) sprintf(foo,"%+g", dp->val);
  796. !   else sprintf(foo,"%g", dp->val);
  797. !   if (dp->inc < 1.0)
  798. !   {
  799. !     int j;
  800. !     if (dp->val == (double)((int)dp->val))
  801. !       strcat(foo,".");
  802. !     for (j = strlen(foo); j < tot; j++)
  803. !       strcat(foo,"0");
  804. !   }
  805.   
  806.     if (dp->units) strcat(foo,dp->units);
  807.     foo1[0] = '\0';
  808.     if (strlen(foo) < (size_t) i) {
  809. !     for (i-=strlen(foo);i>0;i--) strcat(foo1," ");
  810.     }
  811.     strcat(foo1, foo);
  812.   
  813. ***************
  814. *** 411,422 ****
  815.   
  816.   
  817.   /***************************************************/
  818. ! static int computeDialVal(dp, x, y)
  819.   DIAL *dp;
  820.   int x, y;
  821.   {
  822. !   int dx, dy, val;
  823. !   double angle;
  824.   
  825.     /* compute dx, dy (distance from cx, cy).  Note: +dy is *up* */
  826.     dx = x - dp->cx;  dy = dp->cy - y;
  827. --- 429,441 ----
  828.   
  829.   
  830.   /***************************************************/
  831. ! static double computeDialVal(dp, x, y)
  832.   DIAL *dp;
  833.   int x, y;
  834.   {
  835. !   int dx, dy;
  836. !  
  837. !   double angle, val;
  838.   
  839.     /* compute dx, dy (distance from cx, cy).  Note: +dy is *up* */
  840.     dx = x - dp->cx;  dy = dp->cy - y;
  841. ***************
  842. *** 436,443 ****
  843.     if (angle > 270.0) angle -= 360.0;
  844.     if (angle < -90.0) angle += 360.0;
  845.   
  846. !   val = (int) ((dp->max - dp->min) * (240.0 - angle) / 300.0) + dp->min;
  847.   
  848.     return val;
  849.   }
  850.   
  851. --- 455,464 ----
  852.     if (angle > 270.0) angle -= 360.0;
  853.     if (angle < -90.0) angle += 360.0;
  854.   
  855. !   val = ((dp->max - dp->min) * (240.0 - angle) / 300.0) + dp->min;
  856.   
  857. +   /* round value to be an even multiple of dp->inc */
  858. +   val = (double)((int)(val / dp->inc + 0.5)) * dp->inc;
  859.     return val;
  860.   }
  861.   
  862. diff -c3 xv-3.10a/xvdir.c xv-3.10b/xvdir.c
  863. *** xv-3.10a/xvdir.c    Tue Jan  3 14:21:39 1995
  864. --- xv-3.10b/xvdir.c    Tue May 28 14:59:28 1996
  865. ***************
  866. *** 62,67 ****
  867. --- 62,70 ----
  868.   #ifdef HAVE_TIFF
  869.                      "TIFF",
  870.   #endif
  871. + #ifdef HAVE_PNG
  872. +                    "PNG",
  873. + #endif
  874.                      "PostScript",
  875.                      "PBM/PGM/PPM (raw)",
  876.                      "PBM/PGM/PPM (ascii)",
  877. ***************
  878. *** 1115,1120 ****
  879. --- 1118,1132 ----
  880.     }
  881.   #endif
  882.   
  883. + #ifdef HAVE_PNG
  884. +   else if (fmt == F_PNG) {   /* PNG */
  885. +     PNGSaveParams(fullname, col);
  886. +     PNGDialog(1);                   /* open PNG Dialog box */
  887. +     dbut[S_BOK].lit = 0;  BTRedraw(&dbut[S_BOK]);
  888. +     return 0;                      /* always 'succeeds' */
  889. +   }
  890. + #endif
  891.   
  892.   
  893.   
  894. ***************
  895. *** 1168,1174 ****
  896.       
  897.     case F_XPM:
  898.       rv = WriteXPM   (fp, thepic, ptype, w, h, rp, gp, bp, nc, col, 
  899. !              fullname, picComments);    
  900.     case F_FITS:
  901.       rv = WriteFITS  (fp, thepic, ptype, w, h, rp, gp, bp, nc, col, 
  902.                picComments);    
  903. --- 1180,1187 ----
  904.       
  905.     case F_XPM:
  906.       rv = WriteXPM   (fp, thepic, ptype, w, h, rp, gp, bp, nc, col, 
  907. !              fullname, picComments);
  908. !     break;
  909.     case F_FITS:
  910.       rv = WriteFITS  (fp, thepic, ptype, w, h, rp, gp, bp, nc, col, 
  911.                picComments);    
  912. ***************
  913. *** 1380,1393 ****
  914.         (strcmp(lowsuf,"eps" )==0) ||
  915.         (strcmp(lowsuf,"rgb" )==0) ||
  916.         (strcmp(lowsuf,"tga" )==0) ||
  917. -       (strcmp(lowsuf,"xpm" )==0) ||
  918.         (strcmp(lowsuf,"fits")==0) ||
  919.         (strcmp(lowsuf,"fts" )==0) ||
  920.         (strcmp(lowsuf,"jpg" )==0) ||
  921.         (strcmp(lowsuf,"jpeg")==0) ||
  922.         (strcmp(lowsuf,"jfif")==0) ||
  923.         (strcmp(lowsuf,"tif" )==0) ||
  924. !       (strcmp(lowsuf,"tiff")==0)) {
  925.   
  926.       /* found one.  set lowsuf = to the new suffix, and tack on to filename */
  927.   
  928. --- 1393,1413 ----
  929.         (strcmp(lowsuf,"eps" )==0) ||
  930.         (strcmp(lowsuf,"rgb" )==0) ||
  931.         (strcmp(lowsuf,"tga" )==0) ||
  932.         (strcmp(lowsuf,"fits")==0) ||
  933.         (strcmp(lowsuf,"fts" )==0) ||
  934. + #ifdef HAVE_JPEG
  935.         (strcmp(lowsuf,"jpg" )==0) ||
  936.         (strcmp(lowsuf,"jpeg")==0) ||
  937.         (strcmp(lowsuf,"jfif")==0) ||
  938. + #endif
  939. + #ifdef HAVE_TIFF
  940.         (strcmp(lowsuf,"tif" )==0) ||
  941. !       (strcmp(lowsuf,"tiff")==0) ||
  942. ! #endif
  943. ! #ifdef HAVE_PNG
  944. !       (strcmp(lowsuf,"png" )==0) ||
  945. ! #endif
  946. !       (strcmp(lowsuf,"xpm" )==0)) {
  947.   
  948.       /* found one.  set lowsuf = to the new suffix, and tack on to filename */
  949.   
  950. ***************
  951. *** 1422,1427 ****
  952. --- 1442,1451 ----
  953.   
  954.   #ifdef HAVE_TIFF
  955.       case F_TIFF:     strcpy(lowsuf,"tif");  break;
  956. + #endif
  957. + #ifdef HAVE_PNG
  958. +     case F_PNG:      strcpy(lowsuf,"png");  break;
  959.   #endif
  960.       }
  961.   
  962. diff -c3 xv-3.10a/xvevent.c xv-3.10b/xvevent.c
  963. *** xv-3.10a/xvevent.c    Mon Jan 23 16:20:24 1995
  964. --- xv-3.10b/xvevent.c    Wed May 29 01:10:28 1996
  965. ***************
  966. *** 154,160 ****
  967.        int    *donep;
  968.   {
  969.     static int wasInfoUp=0, wasCtrlUp=0, wasDirUp=0, wasGamUp=0, wasPsUp=0;
  970. !   static int wasJpegUp=0, wasTiffUp=0;
  971.   
  972.     static int mainWKludge=0;  /* force first mainW expose after a mainW config
  973.                   to redraw all of mainW */
  974. --- 154,160 ----
  975.        int    *donep;
  976.   {
  977.     static int wasInfoUp=0, wasCtrlUp=0, wasDirUp=0, wasGamUp=0, wasPsUp=0;
  978. !   static int wasJpegUp=0, wasTiffUp=0, wasPngUp=0;
  979.   
  980.     static int mainWKludge=0;  /* force first mainW expose after a mainW config
  981.                   to redraw all of mainW */
  982. ***************
  983. *** 233,238 ****
  984. --- 233,242 ----
  985.       if (TIFFCheckEvent(event)) break;   /* event has been processed */
  986.   #endif
  987.   
  988. + #ifdef HAVE_PNG
  989. +     if (PNGCheckEvent (event)) break;   /* event has been processed */
  990. + #endif
  991.       if (GamCheckEvent (event)) break;   /* event has been processed */
  992.       if (BrowseCheckEvent (event, &retval, &done)) break;   /* event eaten */
  993.       if (TextCheckEvent   (event, &retval, &done)) break;   /* event eaten */
  994. ***************
  995. *** 359,364 ****
  996. --- 363,372 ----
  997.         else if (client_event->window == tiffW) TIFFDialog(0);
  998.   #endif
  999.   
  1000. + #ifdef HAVE_PNG
  1001. +       else if (client_event->window == pngW)  PNGDialog(0);
  1002. + #endif
  1003.         else if (client_event->window == mainW) Quit(0);
  1004.       }
  1005.     }
  1006. ***************
  1007. *** 538,543 ****
  1008. --- 546,555 ----
  1009.   #ifdef HAVE_TIFF
  1010.       if (wasTiffUp) { TIFFDialog(wasTiffUp);  wasTiffUp=0; }
  1011.   #endif
  1012. + #ifdef HAVE_PNG
  1013. +     if (wasPngUp)  { PNGDialog(wasJpegUp);   wasPngUp=0; }
  1014. + #endif
  1015.         }
  1016.       }
  1017.     }
  1018. ***************
  1019. *** 576,581 ****
  1020. --- 588,597 ----
  1021.   #ifdef HAVE_TIFF
  1022.         if (tiffUp) { wasTiffUp = tiffUp;  TIFFDialog(0); }
  1023.   #endif
  1024. + #ifdef HAVE_PNG
  1025. +       if (pngUp)  { wasPngUp  = pngUp;   PNGDialog(0); }
  1026. + #endif
  1027.       }
  1028.         }
  1029.       }
  1030. ***************
  1031. *** 1147,1152 ****
  1032. --- 1163,1172 ----
  1033.       if (TIFFCheckEvent(event)) break;
  1034.   #endif
  1035.       
  1036. + #ifdef HAVE_PNG
  1037. +     if (PNGCheckEvent (event)) break;
  1038. + #endif
  1039. +     
  1040.       if (GamCheckEvent (event)) break;
  1041.       if (BrowseCheckEvent (event, &retval, &done)) break;
  1042.       if (TextCheckEvent   (event, &retval, &done)) break;
  1043. ***************
  1044. *** 1366,1371 ****
  1045. --- 1386,1395 ----
  1046.       if (TIFFCheckEvent(event)) break;
  1047.   #endif
  1048.   
  1049. + #ifdef HAVE_PNG
  1050. +     if (PNGCheckEvent (event)) break;
  1051. + #endif
  1052.       if (GamCheckEvent (event)) break;
  1053.       if (BrowseCheckEvent (event, &retval, &done)) break;
  1054.       if (TextCheckEvent   (event, &retval, &done)) break;
  1055. ***************
  1056. *** 2370,2375 ****
  1057. --- 2394,2403 ----
  1058.   
  1059.   #ifdef HAVE_TIFF
  1060.     if (tiffUp) TIFFDialog(0);  /* close tiff window */
  1061. + #endif
  1062. + #ifdef HAVE_PNG
  1063. +   if (pngUp) PNGDialog(0);    /* close png window */
  1064.   #endif
  1065.   
  1066.     ClosePopUp();
  1067. diff -c3 xv-3.10a/xvgam.c xv-3.10b/xvgam.c
  1068. *** xv-3.10a/xvgam.c    Fri Jan 13 12:51:14 1995
  1069. --- xv-3.10b/xvgam.c    Wed May 29 11:13:56 1996
  1070. ***************
  1071. *** 265,275 ****
  1072.     BTCreate(&gbut[G_BRNDCOL], cmapF,  5 + 66 + 67 + 2, 189, 66, BUTTH, 
  1073.          "Random", infofg, infobg, hicol, locol);
  1074.   
  1075. !   DCreate(&rhDial, cmapF, 5, 215, 66, 100,   0,360,180, 5, 
  1076.         infofg, infobg, hicol, locol, "Hue", NULL);
  1077. !   DCreate(&gsDial, cmapF, 72, 215, 66, 100,  0,360,180, 5, 
  1078.         infofg, infobg, hicol, locol, "Sat.", NULL);
  1079. !   DCreate(&bvDial, cmapF, 139, 215, 66, 100,   0,360,180, 5, 
  1080.         infofg, infobg, hicol, locol, "Value", NULL);
  1081.   
  1082.     rhDial.drawobj = gsDial.drawobj = bvDial.drawobj = dragEditColor;
  1083. --- 265,275 ----
  1084.     BTCreate(&gbut[G_BRNDCOL], cmapF,  5 + 66 + 67 + 2, 189, 66, BUTTH, 
  1085.          "Random", infofg, infobg, hicol, locol);
  1086.   
  1087. !   DCreate(&rhDial, cmapF, 5, 215, 66, 100,   0.0, 360.0, 180.0, 1.0, 5.0, 
  1088.         infofg, infobg, hicol, locol, "Hue", NULL);
  1089. !   DCreate(&gsDial, cmapF, 72, 215, 66, 100,  0.0, 360.0, 180.0, 1.0, 5.0, 
  1090.         infofg, infobg, hicol, locol, "Sat.", NULL);
  1091. !   DCreate(&bvDial, cmapF, 139, 215, 66, 100, 0.0, 360.0, 180.0, 1.0, 5.0, 
  1092.         infofg, infobg, hicol, locol, "Value", NULL);
  1093.   
  1094.     rhDial.drawobj = gsDial.drawobj = bvDial.drawobj = dragEditColor;
  1095. ***************
  1096. *** 359,365 ****
  1097.   
  1098.     srcHD.drawobj = dstHD.drawobj = whtHD.drawobj = dragHueDial;
  1099.   
  1100. !   DCreate(&satDial, hsvF, 100, 199, 100, 121, -100, 100, 0, 5, 
  1101.          infofg, infobg,hicol,locol, "Saturation", "%");
  1102.   
  1103.     hueRB = RBCreate(NULL, hsvF,  7, 153, "1", 
  1104. --- 359,365 ----
  1105.   
  1106.     srcHD.drawobj = dstHD.drawobj = whtHD.drawobj = dragHueDial;
  1107.   
  1108. !   DCreate(&satDial, hsvF, 100, 199, 100, 121, -100.0, 100.0, 0.0, 1.0, 5.0, 
  1109.          infofg, infobg,hicol,locol, "Saturation", "%");
  1110.   
  1111.     hueRB = RBCreate(NULL, hsvF,  7, 153, "1", 
  1112. ***************
  1113. *** 722,728 ****
  1114.   
  1115.     if (whtHD.enabCB.val && whtHD.satval) hsvnonlinear++;
  1116.   
  1117. !   if (satDial.val != 0) hsvnonlinear++;
  1118.   
  1119.     /* check intensity graf */
  1120.     for (i=0; i<256 && intGraf.func[i]==i; i++);
  1121. --- 722,728 ----
  1122.   
  1123.     if (whtHD.enabCB.val && whtHD.satval) hsvnonlinear++;
  1124.   
  1125. !   if (satDial.val != 0.0) hsvnonlinear++;
  1126.   
  1127.     /* check intensity graf */
  1128.     for (i=0; i<256 && intGraf.func[i]==i; i++);
  1129. ***************
  1130. *** 1291,1304 ****
  1131.       rgb2hsv(rcmap[editColor], gcmap[editColor], bcmap[editColor], &h, &s, &v);
  1132.       if (h<0) h = 0;
  1133.   
  1134. !     DSetVal(&rhDial, (int) h);
  1135. !     DSetVal(&gsDial, (int) (s*100));
  1136. !     DSetVal(&bvDial, (int) (v*100));
  1137.     }
  1138.     else {
  1139. !     DSetVal(&rhDial, rcmap[editColor]);
  1140. !     DSetVal(&gsDial, gcmap[editColor]);
  1141. !     DSetVal(&bvDial, bcmap[editColor]);
  1142.     }
  1143.   }
  1144.     
  1145. --- 1291,1304 ----
  1146.       rgb2hsv(rcmap[editColor], gcmap[editColor], bcmap[editColor], &h, &s, &v);
  1147.       if (h<0) h = 0;
  1148.   
  1149. !     DSetVal(&rhDial, h);
  1150. !     DSetVal(&gsDial, s*100);
  1151. !     DSetVal(&bvDial, v*100);
  1152.     }
  1153.     else {
  1154. !     DSetVal(&rhDial, (double)rcmap[editColor]);
  1155. !     DSetVal(&gsDial, (double)gcmap[editColor]);
  1156. !     DSetVal(&bvDial, (double)bcmap[editColor]);
  1157.     }
  1158.   }
  1159.     
  1160. ***************
  1161. *** 1310,1325 ****
  1162.   
  1163.     if (hsvmode) {
  1164.       int rv, gv, bv;
  1165. !     hsv2rgb((double) rhDial.val, ((double) gsDial.val) / 100.0, 
  1166. !         ((double) bvDial.val) / 100.0, &rv, &gv, &bv);
  1167.       rcmap[editColor] = rv;
  1168.       gcmap[editColor] = gv;
  1169.       bcmap[editColor] = bv;
  1170.     }
  1171.     else {
  1172. !     rcmap[editColor] = rhDial.val;
  1173. !     gcmap[editColor] = gsDial.val;
  1174. !     bcmap[editColor] = bvDial.val;
  1175.     }
  1176.   }
  1177.   
  1178. --- 1310,1324 ----
  1179.   
  1180.     if (hsvmode) {
  1181.       int rv, gv, bv;
  1182. !     hsv2rgb(rhDial.val, gsDial.val / 100.0, bvDial.val / 100.0, &rv, &gv, &bv);
  1183.       rcmap[editColor] = rv;
  1184.       gcmap[editColor] = gv;
  1185.       bcmap[editColor] = bv;
  1186.     }
  1187.     else {
  1188. !     rcmap[editColor] = (int)rhDial.val;
  1189. !     gcmap[editColor] = (int)gsDial.val;
  1190. !     bcmap[editColor] = (int)bvDial.val;
  1191.     }
  1192.   }
  1193.   
  1194. ***************
  1195. *** 1561,1569 ****
  1196.       gsDial.title = "Green";
  1197.       bvDial.title = "Blue";
  1198.              
  1199. !     DSetRange(&rhDial, 0, 255, rcmap[editColor], 16);
  1200. !     DSetRange(&gsDial, 0, 255, gcmap[editColor], 16);
  1201. !     DSetRange(&bvDial, 0, 255, bcmap[editColor], 16);
  1202.   
  1203.       XClearWindow(theDisp, rhDial.win);    DRedraw(&rhDial);
  1204.       XClearWindow(theDisp, gsDial.win);    DRedraw(&gsDial);
  1205. --- 1560,1568 ----
  1206.       gsDial.title = "Green";
  1207.       bvDial.title = "Blue";
  1208.              
  1209. !     DSetRange(&rhDial, 0.0, 255.0, (double)rcmap[editColor], 1.0, 16.0);
  1210. !     DSetRange(&gsDial, 0.0, 255.0, (double)gcmap[editColor], 1.0, 16.0);
  1211. !     DSetRange(&bvDial, 0.0, 255.0, (double)bcmap[editColor], 1.0, 16.0);
  1212.   
  1213.       XClearWindow(theDisp, rhDial.win);    DRedraw(&rhDial);
  1214.       XClearWindow(theDisp, gsDial.win);    DRedraw(&gsDial);
  1215. ***************
  1216. *** 1581,1589 ****
  1217.           &h, &s, &v);
  1218.   
  1219.       if (h<0.0) h = 0.0;
  1220. !     DSetRange(&rhDial, 0, 360, (int) h, 5);
  1221. !     DSetRange(&gsDial, 0, 100, (int) (s*100), 5);
  1222. !     DSetRange(&bvDial, 0, 100, (int) (v*100), 5);
  1223.   
  1224.       XClearWindow(theDisp, rhDial.win);    DRedraw(&rhDial);
  1225.       XClearWindow(theDisp, gsDial.win);    DRedraw(&gsDial);
  1226. --- 1580,1588 ----
  1227.           &h, &s, &v);
  1228.   
  1229.       if (h<0.0) h = 0.0;
  1230. !     DSetRange(&rhDial, 0.0, 360.0,     h, 1.0, 5.0);
  1231. !     DSetRange(&gsDial, 0.0, 100.0, s*100, 1.0, 5.0);
  1232. !     DSetRange(&bvDial, 0.0, 100.0, v*100, 1.0, 5.0);
  1233.   
  1234.       XClearWindow(theDisp, rhDial.win);    DRedraw(&rhDial);
  1235.       XClearWindow(theDisp, gsDial.win);    DRedraw(&gsDial);
  1236. ***************
  1237. *** 1891,1897 ****
  1238.       }
  1239.   
  1240.       /* apply satDial value to s */
  1241. !     s = s + ((double) satDial.val) / 100.0;
  1242.       if (s<0.0) s = 0.0;
  1243.       if (s>1.0) s = 1.0;
  1244.   
  1245. --- 1890,1896 ----
  1246.       }
  1247.   
  1248.       /* apply satDial value to s */
  1249. !     s = s + satDial.val / 100.0;
  1250.       if (s<0.0) s = 0.0;
  1251.       if (s>1.0) s = 1.0;
  1252.   
  1253. ***************
  1254. *** 2007,2013 ****
  1255.   
  1256.     gs->hueRBnum = RBWhich(hueRB);
  1257.   
  1258. !   gs->satval = satDial.val;
  1259.     GetGrafState(&intGraf,&gs->istate);
  1260.     GetGrafState(&rGraf,  &gs->rstate);
  1261.     GetGrafState(&gGraf,  &gs->gstate);
  1262. --- 2006,2012 ----
  1263.   
  1264.     gs->hueRBnum = RBWhich(hueRB);
  1265.   
  1266. !   gs->satval = (int)satDial.val;
  1267.     GetGrafState(&intGraf,&gs->istate);
  1268.     GetGrafState(&rGraf,  &gs->rstate);
  1269.     GetGrafState(&gGraf,  &gs->gstate);
  1270. ***************
  1271. *** 2064,2071 ****
  1272.       changed++;
  1273.     }
  1274.       
  1275. !   if (gs->satval != satDial.val) {
  1276. !     DSetVal(&satDial,gs->satval);
  1277.       changed++;
  1278.     }
  1279.   
  1280. --- 2063,2070 ----
  1281.       changed++;
  1282.     }
  1283.       
  1284. !   if (gs->satval != (int)satDial.val) {
  1285. !     DSetVal(&satDial,(double)gs->satval);
  1286.       changed++;
  1287.     }
  1288.   
  1289. ***************
  1290. *** 3200,3206 ****
  1291.   
  1292.     if (whtHD.enabCB.val && whtHD.satval) hsvmod++;
  1293.   
  1294. !   if (satDial.val != 0) hsvmod++;
  1295.   
  1296.     /* check intensity graf */
  1297.     for (i=0; i<256; i++) {
  1298. --- 3199,3205 ----
  1299.   
  1300.     if (whtHD.enabCB.val && whtHD.satval) hsvmod++;
  1301.   
  1302. !   if (satDial.val != 0.0) hsvmod++;
  1303.   
  1304.     /* check intensity graf */
  1305.     for (i=0; i<256; i++) {
  1306. ***************
  1307. *** 3284,3290 ****
  1308.         }
  1309.   
  1310.         /* apply satDial value to s */
  1311. !       s = s + satDial.val;
  1312.         if (s<  0) s =   0;
  1313.         if (s>100) s = 100;
  1314.   
  1315. --- 3283,3289 ----
  1316.         }
  1317.   
  1318.         /* apply satDial value to s */
  1319. !       s = s + (int)satDial.val;
  1320.         if (s<  0) s =   0;
  1321.         if (s>100) s = 100;
  1322.   
  1323. diff -c3 xv-3.10a/xvjpeg.c xv-3.10b/xvjpeg.c
  1324. *** xv-3.10a/xvjpeg.c    Thu Jan  5 01:17:13 1995
  1325. --- xv-3.10b/xvjpeg.c    Wed May 29 11:15:02 1996
  1326. ***************
  1327. *** 87,96 ****
  1328.     
  1329.     XSelectInput(theDisp, jpegW, ExposureMask | ButtonPressMask | KeyPressMask);
  1330.     
  1331. !   DCreate(&qDial, jpegW, 10, 10, 80, 100, 1, 100, 75, 5, 
  1332.         infofg, infobg, hicol, locol, "Quality", "%");
  1333.     
  1334. !   DCreate(&smDial, jpegW, 120, 10, 80, 100, 0, 100, 0, 5, 
  1335.         infofg, infobg, hicol, locol, "Smoothing", "%");
  1336.     
  1337.     BTCreate(&jbut[J_BOK], jpegW, JWIDE-180-1, JHIGH-10-BUTTH-1, 80, BUTTH, 
  1338. --- 85,94 ----
  1339.     
  1340.     XSelectInput(theDisp, jpegW, ExposureMask | ButtonPressMask | KeyPressMask);
  1341.     
  1342. !   DCreate(&qDial, jpegW, 10, 10, 80, 100, 1.0, 100.0, 75.0, 1.0, 5.0, 
  1343.         infofg, infobg, hicol, locol, "Quality", "%");
  1344.     
  1345. !   DCreate(&smDial, jpegW, 120, 10, 80, 100, 0.0, 100.0, 0.0, 1.0, 5.0, 
  1346.         infofg, infobg, hicol, locol, "Smoothing", "%");
  1347.     
  1348.     BTCreate(&jbut[J_BOK], jpegW, JWIDE-180-1, JHIGH-10-BUTTH-1, 80, BUTTH, 
  1349. ***************
  1350. *** 759,766 ****
  1351.   
  1352.   
  1353.     jpeg_set_defaults(&cinfo);
  1354. !   jpeg_set_quality(&cinfo, qDial.val, TRUE);
  1355. !   cinfo.smoothing_factor = smDial.val;
  1356.   
  1357.   
  1358.     jpeg_start_compress(&cinfo, TRUE);
  1359. --- 757,764 ----
  1360.   
  1361.   
  1362.     jpeg_set_defaults(&cinfo);
  1363. !   jpeg_set_quality(&cinfo, (int)qDial.val, TRUE);
  1364. !   cinfo.smoothing_factor = (int)smDial.val;
  1365.   
  1366.   
  1367.     jpeg_start_compress(&cinfo, TRUE);
  1368. ***************
  1369. *** 769,775 ****
  1370.     /*** COMMENT HANDLING ***/
  1371.   
  1372.     sprintf(xvcmt, "%sXV %s  Quality = %d, Smoothing = %d\n",
  1373. !       CREATOR_STR, REVDATE, qDial.val, smDial.val);
  1374.     
  1375.     if (picComments) {   /* append XV comment */
  1376.       char *sp, *sp1;  int done;
  1377. --- 767,773 ----
  1378.     /*** COMMENT HANDLING ***/
  1379.   
  1380.     sprintf(xvcmt, "%sXV %s  Quality = %d, Smoothing = %d\n",
  1381. !       CREATOR_STR, REVDATE, (int)qDial.val, (int)smDial.val);
  1382.     
  1383.     if (picComments) {   /* append XV comment */
  1384.       char *sp, *sp1;  int done;
  1385. diff -c3 xv-3.10a/xvmisc.c xv-3.10b/xvmisc.c
  1386. *** xv-3.10a/xvmisc.c    Fri Jan 13 16:41:34 1995
  1387. --- xv-3.10b/xvmisc.c    Tue May 28 14:57:52 1996
  1388. ***************
  1389. *** 520,525 ****
  1390. --- 520,529 ----
  1391.       if (tiffW) XDestroyWindow(theDisp, tiffW);
  1392.   #endif
  1393.   
  1394. + #ifdef HAVE_PNG
  1395. +     if (pngW)  XDestroyWindow(theDisp, pngW);
  1396. + #endif
  1397.       /* if NOT using stdcmap for images, free stdcmap */
  1398.       if (colorMapMode != CM_STDCMAP) { 
  1399.         int j;
  1400. ***************
  1401. *** 715,720 ****
  1402. --- 719,728 ----
  1403.     
  1404.   #ifdef HAVE_TIFF
  1405.     if (tiffW) XDefineCursor(theDisp, tiffW, otherc);
  1406. + #endif
  1407. + #ifdef HAVE_PNG
  1408. +   if (pngW)  XDefineCursor(theDisp, pngW, otherc);
  1409.   #endif
  1410.   }
  1411.   
  1412. diff -c3 xv-3.10a/xvpopup.c xv-3.10b/xvpopup.c
  1413. *** xv-3.10a/xvpopup.c    Thu Jan 19 11:09:31 1995
  1414. --- xv-3.10b/xvpopup.c    Wed May 29 11:18:43 1996
  1415. ***************
  1416. *** 200,213 ****
  1417.       
  1418.       if (!padHaveDooDads) {
  1419.         DCreate(&padWDial, popW, 16,      puhigh-16-100-1,75,100,
  1420. !           1, 2048, pWIDE, 10,
  1421.             infofg, infobg, hicol, locol, "Width", NULL);
  1422.         DCreate(&padHDial, popW, 16+1+75, puhigh-16-100-1,75,100,
  1423. !           1, 2048, pHIGH, 10,
  1424.             infofg, infobg, hicol, locol, "Height", NULL);
  1425.   
  1426.         DCreate(&padODial, popW, 16+1+75+75+9, puhigh-16-100-1,75,100,
  1427. !           0, 100, 100, 10,
  1428.             infofg, infobg, hicol, locol, "Opaque", NULL);
  1429.   
  1430.         MBCreate(&padMthdMB, popW, 100-2+44, 10, 140, 19, NULL,
  1431. --- 200,213 ----
  1432.       
  1433.       if (!padHaveDooDads) {
  1434.         DCreate(&padWDial, popW, 16,      puhigh-16-100-1,75,100,
  1435. !           1.0, 2048.0, (double)pWIDE, 1.0, 10.0,
  1436.             infofg, infobg, hicol, locol, "Width", NULL);
  1437.         DCreate(&padHDial, popW, 16+1+75, puhigh-16-100-1,75,100,
  1438. !           1.0, 2048.0, (double)pHIGH, 1.0, 10.0,
  1439.             infofg, infobg, hicol, locol, "Height", NULL);
  1440.   
  1441.         DCreate(&padODial, popW, 16+1+75+75+9, puhigh-16-100-1,75,100,
  1442. !           0.0, 100.0, 100.0, 1.0, 10.0,
  1443.             infofg, infobg, hicol, locol, "Opaque", NULL);
  1444.   
  1445.         MBCreate(&padMthdMB, popW, 100-2+44, 10, 140, 19, NULL,
  1446. ***************
  1447. *** 258,266 ****
  1448.     else if (poptyp == ISPAD) {
  1449.       BTSetActive(&bts[0], (int) strlen(gsBuf));
  1450.       i = pWIDE * 3;  RANGE(i,2048,9999);  
  1451. !     DSetRange(&padWDial, 1, i, padWDial.val, 10);
  1452.       i = pHIGH * 3;  RANGE(i,2048,9999);  
  1453. !     DSetRange(&padHDial, 1, i, padHDial.val, 10);
  1454.   
  1455.       DSetActive(&padWDial, (padMode!=PAD_LOAD));  /* DSetRange activates dial */
  1456.       DSetActive(&padHDial, (padMode!=PAD_LOAD));
  1457. --- 258,266 ----
  1458.     else if (poptyp == ISPAD) {
  1459.       BTSetActive(&bts[0], (int) strlen(gsBuf));
  1460.       i = pWIDE * 3;  RANGE(i,2048,9999);  
  1461. !     DSetRange(&padWDial, 1.0, (double)i, padWDial.val, 1.0, 10.0);
  1462.       i = pHIGH * 3;  RANGE(i,2048,9999);  
  1463. !     DSetRange(&padHDial, 1.0, (double)i, padHDial.val, 1.0, 10.0);
  1464.   
  1465.       DSetActive(&padWDial, (padMode!=PAD_LOAD));  /* DSetRange activates dial */
  1466.       DSetActive(&padHDial, (padMode!=PAD_LOAD));
  1467. ***************
  1468. *** 465,473 ****
  1469.     changedGSBuf();      /* careful!  popW doesn't exist yet! */
  1470.   
  1471.     if (padHaveDooDads) { 
  1472. !     oldW = padWDial.val;  
  1473. !     oldH = padHDial.val;
  1474. !     oldO = padODial.val;
  1475.     }
  1476.     else { oldW = pWIDE;  oldH = pHIGH;  oldO = 100; }
  1477.   
  1478. --- 465,473 ----
  1479.     changedGSBuf();      /* careful!  popW doesn't exist yet! */
  1480.   
  1481.     if (padHaveDooDads) { 
  1482. !     oldW = (int)padWDial.val;  
  1483. !     oldH = (int)padHDial.val;
  1484. !     oldO = (int)padODial.val;
  1485.     }
  1486.     else { oldW = pWIDE;  oldH = pHIGH;  oldO = 100; }
  1487.   
  1488. ***************
  1489. *** 486,494 ****
  1490.     }
  1491.   
  1492.     if (rv == 1) {   /* cancelled:  restore normal values */
  1493. !     DSetVal(&padWDial, oldW);
  1494. !     DSetVal(&padHDial, oldH);
  1495. !     DSetVal(&padODial, oldO);
  1496.     }
  1497.   
  1498.     XUnmapWindow(theDisp, padWDial.win);
  1499. --- 486,494 ----
  1500.     }
  1501.   
  1502.     if (rv == 1) {   /* cancelled:  restore normal values */
  1503. !     DSetVal(&padWDial, (double)oldW);
  1504. !     DSetVal(&padHDial, (double)oldH);
  1505. !     DSetVal(&padODial, (double)oldO);
  1506.     }
  1507.   
  1508.     XUnmapWindow(theDisp, padWDial.win);
  1509. ***************
  1510. *** 498,506 ****
  1511.     /* load up return values */
  1512.     *pMode   = padMode;  
  1513.     *pStr    = padBuf;  
  1514. !   *pWide   = padWDial.val;
  1515. !   *pHigh   = padHDial.val;
  1516. !   *pOpaque = padODial.val;
  1517.     *pOmode  = padOMode;
  1518.   
  1519.     return rv;
  1520. --- 498,506 ----
  1521.     /* load up return values */
  1522.     *pMode   = padMode;  
  1523.     *pStr    = padBuf;  
  1524. !   *pWide   = (int)padWDial.val;
  1525. !   *pHigh   = (int)padHDial.val;
  1526. !   *pOpaque = (int)padODial.val;
  1527.     *pOmode  = padOMode;
  1528.   
  1529.     return rv;
  1530. ***************
  1531. *** 972,979 ****
  1532.     else if (popUp == ISPAD) {
  1533.       if (PTINRECT(x, y, padDButt.x, padDButt.y, padDButt.w, padDButt.h)) {
  1534.         if (BTTrack(&padDButt)) {
  1535. !     DSetVal(&padWDial, pWIDE);
  1536. !     DSetVal(&padHDial, pHIGH);
  1537.         }
  1538.       }
  1539.   
  1540. --- 970,977 ----
  1541.     else if (popUp == ISPAD) {
  1542.       if (PTINRECT(x, y, padDButt.x, padDButt.y, padDButt.w, padDButt.h)) {
  1543.         if (BTTrack(&padDButt)) {
  1544. !     DSetVal(&padWDial, (double)pWIDE);
  1545. !     DSetVal(&padHDial, (double)pHIGH);
  1546.         }
  1547.       }
  1548.   
  1549. diff -c3 xv-3.10a/xvps.c xv-3.10b/xvps.c
  1550. *** xv-3.10a/xvps.c    Thu Dec 22 15:34:42 1994
  1551. --- xv-3.10b/xvps.c    Wed May 29 11:04:28 1996
  1552. ***************
  1553. *** 139,147 ****
  1554.     CBCreate(&encapsCB, psW, 240, 7, "preview", infofg, infobg, hicol, locol);
  1555.     CBCreate(&pscompCB, psW, 331, 7, "compress", infofg, infobg, hicol, locol);
  1556.   
  1557. !   DCreate(&xsDial, psW, 240, 30, 80, 100, 10, 800, 100, 5, 
  1558.         infofg, infobg, hicol, locol, "Width", "%");
  1559. !   DCreate(&ysDial, psW, 331, 30, 80, 100, 10, 800, 100, 5, 
  1560.         infofg, infobg, hicol, locol, "Height", "%");
  1561.     xsDial.drawobj = changedScale;
  1562.     ysDial.drawobj = changedScale;
  1563. --- 139,147 ----
  1564.     CBCreate(&encapsCB, psW, 240, 7, "preview", infofg, infobg, hicol, locol);
  1565.     CBCreate(&pscompCB, psW, 331, 7, "compress", infofg, infobg, hicol, locol);
  1566.   
  1567. !   DCreate(&xsDial, psW, 240, 30, 80, 100, 10.0, 800.0, 100.0, 0.5, 5.0, 
  1568.         infofg, infobg, hicol, locol, "Width", "%");
  1569. !   DCreate(&ysDial, psW, 331, 30, 80, 100, 10.0, 800.0, 100.0, 0.5, 5.0, 
  1570.         infofg, infobg, hicol, locol, "Height", "%");
  1571.     xsDial.drawobj = changedScale;
  1572.     ysDial.drawobj = changedScale;
  1573. ***************
  1574. *** 236,245 ****
  1575.   
  1576.     if (rd_int("psres")) {             /* xv.psres:  default paper resolution */
  1577.       if (def_int >= 10 && def_int <= 720) {
  1578. !       int i = (int) ((PIX2INCH * 100) / def_int);
  1579.   
  1580. !       DSetVal(&xsDial, i);
  1581. !       DSetVal(&ysDial, i);
  1582.       }
  1583.     }
  1584.   
  1585. --- 236,245 ----
  1586.   
  1587.     if (rd_int("psres")) {             /* xv.psres:  default paper resolution */
  1588.       if (def_int >= 10 && def_int <= 720) {
  1589. !       double v = (PIX2INCH * 100) / def_int;
  1590.   
  1591. !       DSetVal(&xsDial, v);
  1592. !       DSetVal(&ysDial, v);
  1593.       }
  1594.     }
  1595.   
  1596. ***************
  1597. *** 836,842 ****
  1598.     if (scx < scy) { sz_iny = h * scx; }
  1599.               else { sz_inx = w * scy; }
  1600.   
  1601. !   DSetVal(&xsDial, (int) ((100 * (sz_inx * PIX2INCH) / w) + .5));
  1602.     DSetVal(&ysDial, xsDial.val);
  1603.   
  1604.     sz_inx = (double) w / PIX2INCH * (xsDial.val / 100.0);  
  1605. --- 836,842 ----
  1606.     if (scx < scy) { sz_iny = h * scx; }
  1607.               else { sz_inx = w * scy; }
  1608.   
  1609. !   DSetVal(&xsDial, 100 * (sz_inx * PIX2INCH) / w);
  1610.     DSetVal(&ysDial, xsDial.val);
  1611.   
  1612.     sz_inx = (double) w / PIX2INCH * (xsDial.val / 100.0);  
  1613.